from __future__ import annotations

from dataclasses import dataclass


@dataclass
class LugDesign:
    plate_thickness_mm: float
    hole_diameter_mm: float
    weld_size_mm: float
    note: str


def design_lifting_lug(load_kN: float, allowable_stress_MPa: float = 150.0, pin_diameter_mm: int = 40, weld_strength_MPa: float = 180.0) -> LugDesign:
    """吊耳简化设计：按承压、剪切与焊缝承载给出最小厚度与焊脚尺寸。"""

    import math
    hole_d = pin_diameter_mm + 4
    bearing_required_thk = (load_kN * 1000.0) / (allowable_stress_MPa * hole_d)
    shear_required_thk = (load_kN * 1000.0) / (0.6 * allowable_stress_MPa * hole_d)
    t = max(12.0, bearing_required_thk, shear_required_thk)
    weld = max(6.0, (load_kN * 1000.0) / (weld_strength_MPa * hole_d))
    return LugDesign(plate_thickness_mm=t, hole_diameter_mm=hole_d, weld_size_mm=weld, note="需三维校核与疲劳检查")


